<%@ page contentType="text/html; charset=UTF-8" errorPage="/jsp/error.jsp" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld"  prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld"  prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/custom-html.tld" prefix="chtml" %>

<%@ page import="java.util.ArrayList" %>
<%@ page import="com.erp.framework.util.CommonUtil" %>
<%@ page import="com.erp.framework.util.mainmenu.MenuGroup" %>
<%@ page import="com.erp.framework.util.mainmenu.MenuObject" %>
<%@ page import="com.erp.app.common.ProjectConstants" %>
<%@ page import="com.erp.app.login.web.MainMenuAction" %>

<jsp:useBean id="mainMenuForm" scope="session" type="com.erp.app.login.web.MainMenuForm" />
<!-- NEVER call doLoad() function here, call it via its root parent jsp  -->

<script>
	function doSubmitEnqMenuForm(action, val) {
		document.enqMenuForm.pageEvent.value = action;
		if(val != null) {
			document.enqMenuForm.pageEventSrc.value = val;
		}
		
		document.enqMenuForm.submit();
	}

	function doSubmitEnqMenuFormOtherAction(action, otherAction, otherVal) {
		document.enqMenuForm.pageEvent.value = action;
		if(otherAction != null) {
			document.enqMenuForm.otherPageEvent.value = otherAction;
		}
		if(otherVal != null) {
			document.enqMenuForm.otherPageEventSrc.value = otherVal;
		}

		document.enqMenuForm.submit();
	}

	function doEditAlertTask(docType, projNo) {
		document.enqMenuForm.editDocType.value = docType;
		document.enqMenuForm.editTaskProjNo.value = projNo;
		document.enqMenuForm.pageEvent.value = "<%=MainMenuAction.ACTION_EDIT_ALERT_TASK%>";
		document.enqMenuForm.submit();
	}

	function doEditEnqMenuForm(action, otherAction, docType, projNo, styleLineNo, taskLineNo) {
		document.enqMenuForm.pageEvent.value = action;
		document.enqMenuForm.otherPageEvent.value = otherAction;
		document.enqMenuForm.editDocType.value = docType;
		document.enqMenuForm.editTaskProjNo.value = projNo;
		document.enqMenuForm.editTaskLineNo.value = taskLineNo;
		document.enqMenuForm.editStyleLineNo.value = styleLineNo;
		document.enqMenuForm.submit();
	}

</script>

<script language="javascript" src="<%=request.getContextPath()+ "/js/menu-sys.js" %>">
</script>

<%
ArrayList enqMenuList = mainMenuForm.getMenuList();
pageContext.setAttribute("enqMenuList", enqMenuList);

%>

<form name="enqMenuForm" method="POST" action="/MSWeb/mainMenu.do">
<input type="hidden" name="pageEvent">
<input type="hidden" name="pageEventSrc">
<input type="hidden" name="otherPageEvent">
<input type="hidden" name="otherPageEventSrc">
<input type="hidden" name="editDocNo">
<input type="hidden" name="editDocType">
<input type="hidden" name="editTaskProjNo">
<input type="hidden" name="editTaskLineNo">
<input type="hidden" name="editStyleLineNo">
<table border="0" cellpadding="0" cellspacing="0"  width="100%">
<tr>
    <td height="5px"></td>
 </tr>
<!-- Displays Enquiry Folder -->
<tr>
<logic:iterate id="enqMenuItem" name="enqMenuList" indexId="idx" >
<logic:equal name="enqMenuItem" property="viewDisplay" value="<%=ProjectConstants.GENERIC_YES%>" >
	<logic:equal name="enqMenuItem" property="menuType" value="M" >
		<logic:equal name="enqMenuItem" property="parentMenuId" value="<%=ProjectConstants.PARENT_MENU_ENQ_TAB%>" >
		<%
		    MenuGroup menuGroup = (MenuGroup) enqMenuItem;
		    String url = menuGroup.getMenuUrl();
		    String menuId = menuGroup.getMenuId();

			url = "javascript:doSubmitEnqMenuForm('changeEnqTab', '"+menuId+"');";
		%>
		<!--SELECTED-->
		<logic:equal name="enqMenuItem" property="menuId" value="<%= mainMenuForm.getSelectedEnqMenu() %>" >
			<td class="tabtopcenterdown" width="50%" height="26px"><div class="enq_selectedTxt">
				<div class="txtwhite">
				<b><%=menuGroup.getName()%></b></div>
			</td>

		</logic:equal>
		<!--NOT SELECTED-->
		<logic:notEqual name="enqMenuItem" property="menuId" value="<%= mainMenuForm.getSelectedEnqMenu() %>" >
			<td class="tabtopcenterout" width="50%" height="26px">
				<div class="enq_txtnormal"> <a href="<%= url %>" class='enq_link'><%=menuGroup.getName()%></a></div>
			</td>
		</logic:notEqual>

		</logic:equal>
	</logic:equal>
</logic:equal>
</logic:iterate>
</tr>



<!-- Displays Enquiry Contents -->
<tr>
<logic:iterate id="enqMenuItem" name="enqMenuList" indexId="idx" >
<logic:equal name="enqMenuItem" property="viewDisplay" value="<%=ProjectConstants.GENERIC_YES%>" >
	<logic:equal name="enqMenuItem" property="menuType" value="M" >
		<logic:equal name="enqMenuItem" property="parentMenuId" value="<%=ProjectConstants.PARENT_MENU_ENQ_TAB%>" >
		<%
		    MenuGroup menuGroup = (MenuGroup) enqMenuItem;
		    String url = menuGroup.getMenuUrl();
		    String menuId = menuGroup.getMenuId();
		%>
		<!--SELECTED-->
		<logic:equal name="enqMenuItem" property="menuId" value="<%= mainMenuForm.getSelectedEnqMenu() %>" >
			<td align="center" colspan="2">

			<% String includePage = "/jsp/app/login/enqContent" + (idx.intValue()+1) + ".jsp"; %>
				<jsp:include page="<%=includePage%>"/>
			</td>
		</logic:equal>

		</logic:equal>
	</logic:equal>
</logic:equal>
</logic:iterate>
</tr>

</table>	


</form>

